﻿Public Class F17_Tien_Hien_Tai

    Private Sub btnthoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnthoat.Click
        Me.Close()
    End Sub

    Private Sub F17_Tien_Hien_Tai_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'lay tien trong ngan hang
        Dim tm = 0
        Dim nh = 0
        Dim tk = 0
        Dim no = 0
        Dim td = 0
        Dim dstk = XL_TaiKhoan.LayDS(Me.Tag)
        For Each t In dstk
            ' tien mat
            If t.TenTK = "Tiền mặt" Then
                tm = t.SoDu
            Else
                nh += t.SoDu
            End If
        Next

        'lay tien tiet kiem
        Dim dsso = XL_SoTietKiem.LayDS(Me.Tag)
        For Each s In dsso
            tk += s.SoTien
        Next

        'lay so no
        Dim dsno = XL_No.LayDS(Me.Tag)
        For Each n In dsno
            no += (n.SoTien - n.DaTra)
        Next

        'lay no tin dung
        Dim dstindung = XL_TheTinDung.LayDS(Me.Tag)
        For Each the In dstindung
            td += the.SoTien
        Next

        Labeltm.Text = tm.ToString()
        Labelnh.Text = nh.ToString()
        Labeltk.Text = tk.ToString()
        Labeltd.Text = td.ToString()
        Labelno.Text = no.ToString()
        Labeltong.Text = (tm + nh + tk - td - no).ToString()
    End Sub

    Private Sub btnbc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbc.Click
        Dim f As New frTimKiemThuChi
        f.Tag = Me.Tag
        f.ShowDialog()
    End Sub
End Class